home *** CD-ROM | disk | FTP | other *** search
/ Total Web Page (Professional Suite) / Total Web Page 99.iso / Dhtml / clocks / livedate.js < prev    next >
Text File  |  1998-10-30  |  1KB  |  41 lines

  1. var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
  2. var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
  3.  
  4. function getthedate(){
  5. var mydate=new Date()
  6. var year=mydate.getYear()
  7. if (year<2000)
  8. year="19"+year
  9. var day=mydate.getDay()
  10. var month=mydate.getMonth()
  11. var daym=mydate.getDate()
  12. if (daym<10)
  13. daym="0"+daym
  14. var hours=mydate.getHours()
  15. var minutes=mydate.getMinutes()
  16. var seconds=mydate.getSeconds()
  17. var dn="AM" 
  18. if (hours>12){
  19. dn="PM"
  20. hours=hours-12
  21. }
  22. if (hours==0)
  23. hours=12
  24. if (minutes<=9)
  25. minutes="0"+minutes
  26. if (seconds<=9)
  27. seconds="0"+seconds
  28. //change font size here
  29. var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
  30. +"</b></font></small>"
  31. if (document.all)
  32. document.all.clock.innerHTML=cdate
  33. else
  34. document.write(cdate)
  35. }
  36. if (!document.all)
  37. getthedate()
  38. function goforit(){
  39. if (document.all)
  40. setInterval("getthedate()",1000)
  41. }